package com.woniuxy.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import com.woniuxy.entity.Client;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Update;


@Mapper
public interface ClientMapper {
	
	@Select("select * from t_client")
	public List<Client> findAllClients();
	
	
	@Select("select cname from t_client")
	public List<Client> findClientOfCname();
	
	
	//新增客户
	@Insert("insert into t_client values(default,#{cname},#{status},#{cnumber},#{csname},#{ccodename},#{ccoding},#{carea},#{addtime})")
	public int addClient(Client client);
	
	
	//通过gmid查询当行数据
	@Select("select * from t_client where cid = #{cid}")
	public Client findClientByCid(int cid);
	
	
	//修改当前数据
	@Update("update t_client set cname=#{cname},status=#{status},cnumber=#{cnumber},csname=#{csname},ccodename=#{ccodename},ccoding=#{ccoding},carea=#{carea},addtime=#{addtime} where cid=#{cid}")
	public int modifyClient(Client client);
	
	
	// 通过cid删除一条数据
	@Delete("delete from t_client where cid=#{cid}")
	public int deleteDataByCid(int cid);
}
